home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / w3 / w3-mouse.el.z / w3-mouse.el
Encoding:
Text File  |  1998-05-21  |  3.2 KB  |  93 lines

  1. ;;; w3-menu.el --- Mouse specific functions for emacs-w3
  2. ;; Author: wmperry
  3. ;; Created: 1997/10/17 14:08:18
  4. ;; Version: 1.15
  5. ;; Keywords: mouse, hypermedia
  6.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ;;; Copyright (c) 1996 by William M. Perry <wmperry@cs.indiana.edu>
  9. ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
  10. ;;;
  11. ;;; This file is part of GNU Emacs.
  12. ;;;
  13. ;;; GNU Emacs is free software; you can redistribute it and/or modify
  14. ;;; it under the terms of the GNU General Public License as published by
  15. ;;; the Free Software Foundation; either version 2, or (at your option)
  16. ;;; any later version.
  17. ;;;
  18. ;;; GNU Emacs is distributed in the hope that it will be useful,
  19. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. ;;; GNU General Public License for more details.
  22. ;;;
  23. ;;; You should have received a copy of the GNU General Public License
  24. ;;; along with GNU Emacs; see the file COPYING.  If not, write to the
  25. ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  26. ;;; Boston, MA 02111-1307, USA.
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. (require 'w3-vars)
  29.  
  30. (defun w3-follow-mouse-other-frame (e)
  31.   "Function suitable to being bound to a mouse key.  Follows the link under
  32. the mouse click, opening it in another frame."
  33.   (interactive "e")
  34.   (mouse-set-point e)
  35.   (w3-follow-link-other-frame))
  36.  
  37. (defun w3-follow-inlined-image-mouse (e)
  38.   "Follow an inlined image from the mouse"
  39.   (interactive "e")
  40.   (mouse-set-point e)
  41.   (w3-follow-inlined-image))
  42.  
  43. (defun w3-follow-inlined-image ()
  44.   "Follow an inlined image, regardless of whether it is a hyperlink or not."
  45.   (interactive)
  46.   (let ((widget (widget-at (point))))
  47.     (and (not widget) (error "No inlined image at point."))
  48.     (setq widget (widget-get widget :parent))
  49.     
  50.     (and (or (not widget)
  51.          (not (eq 'image (car widget))))
  52.      (error "No inlined image at point."))
  53.     (and (widget-get widget :src)
  54.      (w3-fetch (widget-get widget :src)))))
  55.  
  56. (defvar w3-mouse-button1 (cond
  57.               ((featurep 'infodock) nil)
  58.               ((and w3-running-xemacs (featurep 'mouse)) 'button1)
  59.               (w3-running-xemacs nil)
  60.               (t 'down-mouse-1)))
  61. (defvar w3-mouse-button2 (cond
  62.               ((featurep 'infodock) nil)
  63.               ((and w3-running-xemacs (featurep 'mouse)) 'button2)
  64.               (w3-running-xemacs nil)
  65.               (t 'down-mouse-2)))
  66. (defvar w3-mouse-button3 (cond
  67.               ((featurep 'infodock) nil)
  68.               ((and w3-running-xemacs (featurep 'mouse)) 'button3)
  69.               (w3-running-xemacs nil) 
  70.               (t 'down-mouse-3)))
  71.  
  72. (if w3-mouse-button3
  73.     (define-key w3-mode-map (vector w3-mouse-button3) 'w3-popup-menu))
  74.  
  75. (if w3-mouse-button1
  76.     (define-key w3-netscape-emulation-minor-mode-map
  77.       (vector w3-mouse-button1) 'w3-widget-button-click))
  78.       
  79. (if w3-mouse-button2
  80.     (progn
  81.       (define-key w3-mode-map (vector (list 'meta w3-mouse-button2))
  82.     'w3-follow-mouse-other-frame)
  83.       (define-key w3-netscape-emulation-minor-mode-map
  84.     (vector w3-mouse-button2) 'w3-follow-mouse-other-frame)))
  85.  
  86. (if (not w3-running-xemacs)
  87.     (progn
  88.       (define-key w3-mode-map [mouse-movement] 'w3-mouse-handler)
  89.       (if w3-popup-menu-on-mouse-3
  90.       (define-key w3-mode-map [down-mouse-3] 'w3-popup-menu))))
  91.   
  92. (provide 'w3-mouse)
  93.